<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>回顾Obeject.defineProperty</title>
</head>
<body>
<script type="text/javascript">
    let number=18
  let person = {
    name:"张三",
    sex:'男',
    //age:18
  }
  //Object.defineProperty默认不可遍历,即ennumerable默认为false,且不可修改，writeable默认false
  //
  // Object.defineProperty(person,'age',{
  //   value:18,
  //   enumerable:true,//控制是否可枚举
  //   writable:true,//控制是否可修改
  //   configurable:true//控制是否可以删除
  // })
  Object.defineProperty(person,'age',{
      get() {
          return number;
      },
      set(v) {
          number = v;
          console.log('setter successful');
      }
  })



</script>
</body>
</html>